﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GUI
{
    public partial class FrmDatabase : Form
    {

        DBInfo dbInfo;

        public FrmDatabase(DBInfo info)
        {
            InitializeComponent();
            this.dbInfo = info;
            txtPassword2.Visible = false;
            txtBrugernavn.Text = info.USER;
            txtDatabase.Text = info.DATABASE;
            txtPassword.Text = txtPassword2.Text = info.PASSWD;
            txtServer.Text = info.SERVER;
        }


        private void btnAnuller_Click(object sender, EventArgs e)
        {
            this.Close();
        }


        private void chkVis_CheckedChanged(object sender, EventArgs e)
        {
            if (chkVis.Checked)
            {
                txtPassword2.Visible = true;
                txtPassword.Visible = false;

            }
            else
            {
                txtPassword2.Visible = false;
                txtPassword.Visible = true;

            }
        }


        private void btnGem_Click(object sender, EventArgs e)
        {
            if (dbInfo.SkrivTilInfoFil(txtBrugernavn.Text, txtServer.Text, txtPassword2.Text, txtDatabase.Text))
                lblStatus.Text = "Ændringer Gemt.";
        }
    }
}
